Feedback-directed optimization (FDO) is a technique used to tune application executions based on application runtime behavior in order to improve performance. FDO is also known as Profile Guided Optimization (PGO) and Profile Based Optimization (PBO). In order to tune applications, FDO conducts profiling on the applications. Profiling is the process of gathering information about how an application behaves during runtime. This profile information is used to drive decisions regarding various application optimizations.
As illustrated in FIG. 1, customary feedback-directed optimization is a dual build model technique that uses static instrumentation to collect edge and value profiles. An instrumentation build (101) allows the compiler to insert code into an application's binary to create an instrumented version of the binary (102). This inserted code typically counts edges or collects value profiles. The instrumented binary (102) is run on a representative set of training data (104) in a training run (103). At the end of the training execution, all collected edge counts and value information is written and aggregated in a profile database or gcov data file (GCDA) (105). An optimization build (106) then occurs in which the compiler uses the generated profile to make optimization decisions such as inline decisions, instruction scheduling, basic block re-ordering, function splitting, and register allocation.
One problem with customary FDO is that the technique relies on compilers that do not understand the high-level details of the applications on which FDO runs. For example, compilers do not know application-specific algorithms or parameters. Customary feedback-directed optimization can therefore only handle a very limited set of low level profiles, such as control flow edge profiling or a predefined set of value profiles including indirect function call targets, string function call size, and alignment profiles.
In many cases, software developers have in-depth knowledge of high-level details for their applications. Developers often know which aspects of their code are important and which parameters should be tuned in order to improve application performance. However, in common runtime libraries, these parameters are either left untuned or the parameters are tuned for average applications since customary FDO processes do not allow for user-defined profile optimizations. Although some developers choose to manually tune their code for specific applications, manual processes can be labor-intensive. As recognized by the inventors, there should be a framework that allows easy application performance tuning that can be done automatically during compilation.